package com.lxw.filesystem.service.impl;

import com.aliyun.oss.OSS;
import com.lxw.filesystem.config.FileConfig;
import com.lxw.filesystem.service.IOssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.io.InputStream;

@Service
public class OssServiceImpl implements IOssService {

    @Value("${ysp.oss.BucketName}")
    public String bucketName;

    //问价bucket 域名
    @Value("${ysp.oss.Bucket}")
    public String bucket;

    @Autowired
    OSS ossClient;

    @Override
    public String UploadFile(String fileName,InputStream inputStream) {
        ossClient.putObject(bucketName,fileName,inputStream);


        // 访问文件地址
        return bucket+ fileName;

    }
}
